package com.github_Dididipapa.shortlink.project.controller;

import com.github_Dididipapa.shortlink.project.common.result.R;
import com.github_Dididipapa.shortlink.project.common.result.Rs;
import com.github_Dididipapa.shortlink.project.service.UrlResourceService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @description: To be defined
 * @author: dididi_papa
 * @email: mitis1624087624@gmail.com
 * @date: 2025/09/17  21:59
 */
@RestController("/api/short-link/core/v1")
@RequiredArgsConstructor
public class UrlResourceController {

    private final UrlResourceService urlResourceService;


    /**
     * @description: 获取url的标题
     * @param: [url]
     * @return: com.github_Dididipapa.shortlink.project.common.result.R<java.lang.String>
     * @author: dididi_papa
     * @date: 2025/09/17  21:59
     */
    @GetMapping("title")
    public R<String> getUrlTitle(@RequestParam("url") String url) {
        return Rs.success(urlResourceService.getUrlTitle(url));
    }
}
